function showMsg(elemt,show,msg)
{
    var $obj;
    
    if(typeof elemt == 'object')
    {
        $obj = elemt;
    }else{
        $obj = $('#'+elemt);
    }
    if (show) 
    {
        if(msg)
        {
            $obj.text(msg);
        }
        $obj.show();
    }else
    {
        $obj.hide();
    }
}

$(function(){
    //删除警告
    $('.link-del').click(function(){
        var _href = $(this).attr('href');
        if(confirm('确定删除吗？')) {
            window.location.href = _href;
        }else{
            return false;
        }
        return false;
    });
    //克隆警告
    $('.link-clone').click(function(){
        /*var _id = $(this).attr('data-id');
        var $clone_form = $('#clone_form');*/
        var _href = $(this).attr('href');
        if(n = window.prompt('请输入克隆的份数')) {
            /*$clone_form.find('input[name=id]').val(_id);
            $clone_form.find('input[name=num]').val(n);
            $clone_form.submit();*/
            //_href = decodeURI(_href).
            _href =  decodeURI(_href).replace("var",n);
            window.location.href = _href;
            return false;
        }else{
            return false;
        }
    });

    $('.allChoose').click(function(){
        var _check = $(this).attr('checked');
        if(_check){
            $('.tc').find('input[type=checkbox]').attr('checked',true);
        }else{
            $('.tc').find('input[type=checkbox]').attr('checked',false);
        }
    });

    var _host = window.location.href;
    var current_link;
    $('.sidebar-list').find('a').each(function(index,e){
        current_link = $(e).attr('href');
        if(_host.indexOf(current_link) > 0){
            $(e).parent().addClass('on');
        }
    });
    //console.log(_host);
})